Skip to main content

Viability Test

Analyze sites before scraping to find the best strategy. Tests each URL with multiple scraping modes and reports what works.

Basic usage

test = client.create_viability_test(
["https://example.com", "https://hard-site.com"],
depth="full",
)

import time
while True:
result = client.get_viability_test(test.run_id)
if result.status == "completed":
break
time.sleep(2)

for r in result.results:
print(f"{r.url}: {r.recommended_strategy}")
print(f" Difficulty: {r.difficulty}")
print(f" Best mode: {r.best_mode}")
print(f" Browser needed: {r.javascript_required}")

Depth levels

Control how many modes are tested:

DepthModes testedCredits per URL
"quick"Simple HTTP only~1
"standard"Simple + proxy + browserup to 7
"full" (default)All modes including browser+proxyup to 12
# Quick check — just test simple HTTP
test = client.create_viability_test(urls, depth="quick")

# Full analysis — test every mode
test = client.create_viability_test(urls, depth="full")

Per-mode results

The modes_tested dict shows results for each scraping mode:

for r in result.results:
if r.modes_tested:
for mode, data in r.modes_tested.items():
status = "OK" if data.success else "BLOCKED"
print(f" {mode}: {status} ({data.time_ms}ms, {data.credits} credits)")
if data.captcha_type:
print(f" CAPTCHA: {data.captcha_type}")

Key result fields

FieldDescription
difficulty"easy", "medium", or "hard"
best_modeCheapest mode that worked (e.g. "simple", "browser_proxy")
recommended_strategySuggested scraping approach
suggested_paramsDict of params to use with client.scrape()
modes_testedDict of mode name to ViabilityModeResult
total_credits_usedCredits consumed across all mode tests
captcha_detectedWhether CAPTCHA was found
captcha_providersList of protection providers
javascript_requiredWhether browser rendering is needed
cloudflare_levelCloudflare protection level